import axios from '@/api/api' // 导入 api

// 单独倒出
// 密文验证
export const Preflight = params => {
  return axios({
    url: '/api_h5/VtwSetH/1',
    method: 'get',
    params
  })
}
// 获取服务器时间
export const getServerTime = params => {
  return axios({
    url: '/api_h5/GetTime/1',
    method: 'get',
    params
  })
}
// 获取分类数据
export const getCate = data => {
  return axios({
    url: '/api_h5/Cate/1',
    method: 'post',
    data
  })
}
// 获取轮播图
export const getBanner = data => {
  return axios({
    url: '/api_h5/Banners/1',
    method: 'post',
    data
  })
}
// 获取书城接口
export const getNovel = data => {
  return axios({
    url: '/api_h5/Novel/1/',
    method: 'post',
    data
  })
}

// 获取书籍详情
export const getDetail = data => {
  return axios({
    url: '/api_h5/Detail/1/',
    method: 'post',
    data
  })
}

// 获取书籍章节
export const getChapter = data => {
  return axios({
    url: '/api_h5/ChapterLt/1/',
    method: 'post',
    data
  })
}

// 获取章节内容
export const getContent = data => {
  return axios({
    url: '/api_h5/ChapterIn/1/',
    method: 'post',
    data
  })
}
// 请求txt内容
export const getTexts = (head, body,params) => {
  let origin=''
  if (head.includes('dwtxt2.17k.ren')) {
    origin = '/txt_h'
  } else if (head.includes('upld.17k.ren')) {
    origin = '/txt_s'
  }
  return axios({
    url: origin + body,
    method: 'get',
    params
  })
}
// 获取热门搜索
export const getKey = data => {
  return axios({
    url: '/api_h5/Key/1/',
    method: 'post',
    data
  })
}

// 获取搜索结果
export const getSearch = data => {
  return axios({
    url: '/api_h5/Search/1/',
    method: 'post',
    data
  })
}
// 默认全部倒出
export default {
  Preflight,
  getServerTime,
  getCate,
  getBanner,
  getNovel,
  getDetail,
  getChapter,
  getContent,
  getKey,
  getSearch,
  getTexts
}
